package com.hyk.Service;

import com.hyk.Dao.User;
import com.hyk.Dao.UserDao;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.annotation.Resource;

@Service
public class UserService implements UserServiceInterface{

    @Resource
    private UserDao userDao;

    @Override
    public boolean doLogin(String userName, String passWord) {
        if (StringUtils.isEmpty(userName)){
            return false;
        }
        if (StringUtils.isEmpty(passWord)){
            return false;
        }

        User user = userDao.selectByUsername(userName);

        if (user == null){
            return false;
        }

        if (!passWord.equals(user.getPassWord())){
            return false;
        }

        return true;

    }
}
